package PTA_JAVA.JavaA.Javademo13;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Person[] p = new Person[n];
        for (int i = 0; i < n; i++) {
            p[i] = new Person(sc.next(),sc.nextInt(),sc.nextBoolean());
        }
        for (int i = n-1; i >=0; i--) {
            System.out.println(p[i]);
        }
        Person p1 = new Person();
        System.out.println(p1);
    }
}
class Person{
    static int count=0;
    private String name;
    private int age;
    private boolean gender;
    private int id;

    public Person(){
        System.out.println("This is constructor");
        System.out.println(name+","+age+","+gender+","+id);
    }

    public Person(String name, int age, boolean gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Person [" +
                "name=" + name +
                ", age=" + age +
                ", gender=" + gender +
                ", id=" + id +
                "]";
    }

    {
        id=count;
        count++;
        System.out.println("This is initialization block, id is "+id);
    }
    static{
        System.out.println("This is static initialization block");
    }
}
